package vn.com.ltv.lo.common;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesUtil {
		
	
	//----------------save array--------------------------------------------
	static public boolean saveArrayNumber(int[] array, Context mContext) {   
	    SharedPreferences prefs = mContext.getSharedPreferences("ListSeries", Context.MODE_PRIVATE);  
	    SharedPreferences.Editor editor = prefs.edit();  
	    editor.clear();	   
	    editor.putInt("ListSeries" +"_size", array.length);  
	    for(int i=0;i<array.length;i++)  
	        editor.putInt("ListSeries" + "_" + i, array[i]);  
	    return editor.commit();  
	} 
		
	static public int[] loadArrayNumber(Context mContext) {  
	    SharedPreferences prefs = mContext.getSharedPreferences("ListSeries", Context.MODE_PRIVATE);  
	    int size = prefs.getInt("ListSeries" + "_size", 0);  
	    int array[] = new int[size];  
	    for(int i=0;i<size;i++)  
	        array[i] = prefs.getInt("ListSeries" + "_" + i, -1);  
	    return array;  
	}
	
}
